using System.Runtime.InteropServices;
using System;

namespace Recast
{
	public unsafe partial class RecastGlobal
	{
		[StructLayout(LayoutKind.Sequential)]
		public unsafe partial struct rcHeightfield : IDisposable
		{
			public int width;
			public int height;
			public fixed float bmin[3];
			public fixed float bmax[3];
			public float cs;
			public float ch;
			public rcSpan** spans;
			public rcSpanPool* pools;
			public rcSpan* freelist;

			public void Dispose()
			{
				rcFree(spans);
				while (null != pools)
				{
					rcSpanPool* next = pools->next;
					rcDelete(pools);
					pools = next;
				}
			}
		}
	}
}
